package com.yyy.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "t_pnr")
@NamedEntityGraph(
        name = "passengersQuery",
        attributeNodes = {@NamedAttributeNode(value = "passengers")}
)
public class Pnr implements Serializable {

    /**
     * 默认的序列化 id.
     */
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String pnr;

    private Integer passengeTotal;

    private Date createTime;

    private Date updateTime;

    private String issueOfficeCode;

    @OneToMany(fetch = FetchType.EAGER, mappedBy = "pnr")
    private List<Passenger> passengers;

    public List<Passenger> getPassengers() {
        return passengers;
    }

    public void setPassengers(List<Passenger> passengers) {
        this.passengers = passengers;
    }

    public Integer getId() {
        return id;
    }

    public void setId(final Integer id) {
        this.id = id;
    }

    public String getPnr() {
        return pnr;
    }

    public void setPnr(final String pnr) {
        this.pnr = pnr;
    }

    public Integer getPassengeTotal() {
        return passengeTotal;
    }

    public void setPassengeTotal(final Integer passengeTotal) {
        this.passengeTotal = passengeTotal;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(final Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(final Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getIssueOfficeCode() {
        return issueOfficeCode;
    }

    public void setIssueOfficeCode(final String issueOfficeCode) {
        this.issueOfficeCode = issueOfficeCode;
    }
}
